# 定义棋盘大小
BOARD_SIZE = 9

# 棋子定义
class Piece:
    def __init__(self, name, x, y):
        self.name = name
        self.x = x
        self.y = y

    def __str__(self):
        return self.name

# 初始棋局
pieces = [
    Piece("車", 0, 0), Piece("馬", 1, 0), Piece("象", 2, 0), Piece("士", 3, 0),
    Piece("將", 4, 0), Piece("士", 5, 0), Piece("象", 6, 0), Piece("馬", 7, 0),
    Piece("車", 8, 0), Piece("砲", 1, 2), Piece("砲", 7, 2), Piece("兵", 0, 3),
    Piece("兵", 2, 3), Piece("兵", 4, 3), Piece("兵", 6, 3), Piece("兵", 8, 3),
    Piece("卒", 0, 6), Piece("卒", 2, 6), Piece("卒", 4, 6), Piece("卒", 6, 6),
    Piece("卒", 8, 6), Piece("車", 0, 9), Piece("馬", 1, 9), Piece("象", 2, 9),
    Piece("士", 3, 9), Piece("帥", 4, 9), Piece("士", 5, 9), Piece("象", 6, 9),
    Piece("馬", 7, 9), Piece("車", 8, 9), Piece("炮", 1, 7), Piece("炮", 7, 7)
]

# 棋子移动规则
def can_move(piece, x, y):
    if piece.x == x and piece.y == y:
        return False

    if x < 0 or x >= BOARD_SIZE or y < 0 or y >= BOARD_SIZE:
        return False

    if piece.name == "車" or piece.name == "車":
        if piece.x != x and piece.y != y:
            return False

        if piece.x == x:
            start = min(piece.y, y) + 1
            end = max(piece.y, y)
            for i in range(start, end):
                if get_piece(piece.x, i) is not None:
                    return False
        else:
            start = min(piece.x, x) + 1
            end = max(piece.x, x)
            for i in range(start, end):
                if get_piece(i, piece.y) is not None:
                    return False

    elif piece.name == "馬" or piece.name == "馬":
        dx = abs(x - piece.x)
        dy = abs(y - piece.y)
        if dx * dy != 2:
            return False

        if dx == 2:
            mx = (piece.x + x) // 2
            if get_piece(mx, piece.y) is not None:
                return False
        else:
            my = (piece.y + y) // 2
            if get_piece(piece.x, my) is not None:
                return False

    elif piece.name == "象" or piece.name == "相":
        dx = abs(x - piece.x)
        dy = abs(y - piece.y)
        if dx != 2 or dy != 2:
            return False

        mx = (piece.x + x) // 2
        my = (piece.y + y) // 2
        if get_piece(mx, my) is not None:
            return False

        if y < 5:
            return False

    elif piece.name == "士" or piece.name == "仕":
        dx = abs(x - piece.x)
        dy = abs(y - piece.y)
        if dx != 1 or dy != 1:
            return False

        if y < 7 or y > 9:
            return False

    elif piece.name == "將" or piece.name == "帥":
        dx = abs(x - piece.x)
        dy = abs(y - piece.y)
        if dx + dy != 1:
            return False

        if y < 7 or y > 9:
            return False

    elif piece.name == "兵" or piece.name == "卒":
        dx = abs(x - piece.x)
        dy = abs(y - piece.y)
        if dx + dy != 1:
            return False

        if piece.y < 5 and y > piece.y:
            return False

        if piece.y >= 5 and y < piece.y:
            return False

    elif piece.name == "砲" or piece.name == "炮":
        if piece.x != x and piece.y != y:
            return False

        count = 0
        if piece.x == x:
            start = min(piece.y, y) + 1
            end = max(piece.y, y)
            for i in range(start, end):
                if get_piece(piece.x, i) is not None:
                    count += 1
        else:
            start = min(piece.x, x) + 1
            end = max(piece.x, x)
            for i in range(start, end):
                if get_piece(i, piece.y) is not None:
                    count += 1

        if count == 0 and get_piece(x, y) is not None:
            return False

        if count == 1 and get_piece(x, y) is None:
            return False

    else:
        return False

    return True

# 获取棋子信息
def get_piece(x, y):
    for piece in pieces:
        if piece.x == x and piece.y == y:
            return piece
    return None

# 打印棋盘
def print_board():
    for y in range(BOARD_SIZE):
        for x in range(BOARD_SIZE):
            piece = get_piece(x, y)
            if piece is None:
                print(".", end=" ")
            else:
                print(piece, end=" ")
        print()

# 游戏循环
while True:
    print_board()

    # 输入移动指令
    print("请走棋")
    from_x, from_y, to_x, to_y = map(int, input().split())

    # 获取要移动的棋子
    piece = get_piece(from_x, from_y)
    if piece is None:
        print("无效的棋子")
        continue

    # 检查移动是否合法
    if not can_move(piece, to_x, to_y):
        print("无效的移动")
        continue

    # 判断是否吃掉对方棋子
    target_piece = get_piece(to_x, to_y)
    if target_piece is not None:
        pieces.remove(target_piece)

    # 移动棋子
    piece.x = to_x
    piece.y = to_y

    # 判断胜负
    if piece.name == "將" or piece.name == "帥":
        print("黑方胜利" if piece.name == "將" else "红方胜利")
        break